/* 导出 PDF 设置 */

/* 修改导出的 PDF 的页边距 */
@page {
  margin: 15mm -10mm !important;
}

/* 导出 PDF，基本设置 */
@media print {
  table,
  pre {
    page-break-inside: avoid;
  }

  pre {
    word-wrap: break-word;
  }
}

/* 标题设置 */
@media print {
  .typora-export * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  /* 导出PDF，使得标题等级提示消失 */
  h2::before,
  h3::before,
  h4::before,
  h5::before,
  h6::before {
    display: none !important;
  }
}

/* 脚注设置 */
@media print {
  .footnotes-area {
    font-size: 0.85rem;
    font-family: "HarmonyOS_Sans_SC_Thin";
    color: #777 !important;
    line-height: 1.5;
  }

  .footnotes-area hr {
    margin-top: 0 !important;
    margin-bottom: 10px !important;
  }
}

/* 图片设置 */
@media print {
  #write img {
    padding: 0 auto !important;
    margin: 0 auto !important;
    border: none !important;
  }
}

/* 引用块设置 */
@media print {
  /* 保留引用样式块的图标 */
  #write blockquote :is(h1, h2, h3, h4, h5, h6)h2::before {
    display: block !important;
  }

  #write blockquote {
    background-color: #fff !important;
  }
}

/* 取消导出目录的右边框 */
@media print {
  #write
    :is(.md-toc-h1, .md-toc-h2, .md-toc-h3, .md-toc-h4, .md-toc-h5, .md-toc-h6)
    .md-toc-inner,
  #write
    :is(
      .md-toc-h1,
      .md-toc-h2,
      .md-toc-h3,
      .md-toc-h4,
      .md-toc-h5,
      .md-toc-h6
    ):hover
    .md-toc-inner {
    border-right: none !important;
  }
}

/* 正文目录 */
@media print {
  #write .md-toc {
    margin: 20px 0;
    box-shadow: none;
    padding: 35px 0 20px 0;
    background-color: transparent !important;
    /* 目录后分页 */
    page-break-after: always;
  }

  #write .md-toc::before {
    width: 100%;
    background-color: rgb(57, 108, 175, 0.15) !important;
    padding: 6px !important;
  }
}

/* 代码块 */
@media print {
  /* 防止代码块最后一行显示不完整 */
  pre div.CodeMirror-scroll,
  #write pre div.CodeMirror-scroll {
    padding-bottom: 4px !important;
  }

  #write .CodeMirror-gutters {
    border-width: 2px !important;
    height: 105% !important;
  }
}

@media print {
  #write a[alt|="badge"] {
    position: relative;
    display: initial !important;
  }
}
